有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java REST Web服务是否支持提供zip文件的范围标头?

我正在使用Spring/ApacheCXF在Java中开发一个Rest完整Web服务,该服务将负责向Web服务客户端提供压缩文件

web服务客户端也将用java编写,它是JavaFX桌面应用程序的一部分

此文件的大小可以是20MB。我想启用简历下载支持。因此,如果客户端下载被中断。它可以从中断点恢复下载

Rest服务中是否支持范围标头?有什么建议吗

找到相关问题,但没有对查询的最终答复

Enable resuming interrupt download in REST web service using Java

谢谢 穆克什·卡塔里亚


共 (1) 个答案

  1. # 1 楼答案

    绝对-您可以自由指定任何您喜欢的范围单位

    来自RFC 2616:

    3.12 Range Units

    HTTP/1.1 allows a client to request that only part (a range of) the
    response entity be included within the response. HTTP/1.1 uses range units in the Range (section 14.35) and Content-Range (section 14.16)
    header fields. An entity can be broken down into subranges according to various structural units.

      range-unit       = bytes-unit | other-range-unit
      bytes-unit       = "bytes"
      other-range-unit = token
    

    The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
    implementations MAY ignore ranges specified using other units.